package cn.fxl.hystrix;

import cn.fxl.domain.User;
import cn.fxl.feign.UserStoreClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserHystrix implements FallbackFactory<UserStoreClient> {
    @Override
    public UserStoreClient create(Throwable throwable) {
        return new UserStoreClient() {
            @Override
            public User getById(Long id) {
                return new User(-1L,"熔断","熔断");
            }
        };
    }
}
